﻿<phoneNavigation:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phoneNavigation="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:rbc="clr-namespace:RedBit.WindowsPhone.Controls;assembly=RedBit.WindowsPhone.Controls"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" 
    xmlns:ic="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:vm="clr-namespace:VanGuideWP7.ViewModel"
    xmlns:VanGuideWP7="clr-namespace:VanGuideWP7" 
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    x:Class="VanGuideWP7.View.SettingsPage"
                                      mc:Ignorable="d"
                                      d:DesignWidth="480"
                                      d:DesignHeight="800"
                                      >
    <!--Page transition animation-->
    <phoneNavigation:PhoneApplicationPage.Resources>
        <Storyboard x:Name="ResetPageTransitionList">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="TitleGrid" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="TitleGrid" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.CenterOfRotationX)">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="ContentGrid" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="ContentGrid" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.CenterOfRotationX)">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
        <Storyboard x:Name="PageTransitionList">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="TitleGrid" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="00:00:00.3" Value="90">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseIn"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="TitleGrid" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.CenterOfRotationX)">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="00:00:00.3" Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseIn"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="ContentGrid" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="00:00:00.3" Value="90">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseIn"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="ContentGrid" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.CenterOfRotationX)">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="00:00:00.3" Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseIn"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
        <Style x:Key="PhoneToggleButtonBase" BasedOn="{StaticResource PhoneButtonBase}" TargetType="ToggleButton">
            <Setter Property="HorizontalContentAlignment" Value="Left"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ToggleButton">
                        <Border x:Name="LayoutRoot" Background="Transparent">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="Foreground" Storyboard.TargetName="foregroundContainer">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="LayoutRoot">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="Background" Storyboard.TargetName="LayoutRoot">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TransparentBrush}"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="CheckStates">
                                    <VisualState x:Name="Unchecked"/>
                                    <VisualState x:Name="Checked">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Background" Storyboard.TargetName="CheckedContainer">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneForegroundBrush}"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Foreground" Storyboard.TargetName="foregroundContainer">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneBackgroundBrush}"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Border x:Name="CheckedContainer" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Margin="{StaticResource PhoneTouchTargetOverhang}">
                                <ContentControl x:Name="foregroundContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            </Border>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="PhoneRadioButtonCheckBoxBase" BasedOn="{StaticResource PhoneToggleButtonBase}" TargetType="ToggleButton">
            <Setter Property="Background" Value="{StaticResource PhoneBorderBrush}"/>
            <Setter Property="BorderBrush" Value="{StaticResource PhoneBorderBrush}"/>
            <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
            <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}"/>
            <Setter Property="MinWidth" Value="160"/>
            <Setter Property="MinHeight" Value="56"/>
            <Setter Property="Padding" Value="0"/>
        </Style>
        <Style x:Key="CheckBoxStyle1" BasedOn="{StaticResource PhoneRadioButtonCheckBoxBase}" TargetType="CheckBox">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="CheckBox">
                        <Grid Background="Transparent">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="imgCheckboxCheckmark"/>
                                            <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="imgCheckboxCheckmarkDisabled"/>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="MouseOver"/>
                                    <VisualState x:Name="Pressed"/>
                                    <VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="imgCheckboxCheckmark"/>
                                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="imgCheckboxCheckmarkDisabled"/>
                                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(Foreground)" Storyboard.TargetName="foregroundContainer">
                                                <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{StaticResource PhoneInactiveBrush}"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="CheckStates">
                                    <VisualState x:Name="Checked">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="imgCheckboxCheckmark">
                                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Visible</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="imgCheckboxCheckmarkDisabled">
                                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Visible</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Unchecked">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="imgCheckboxCheckmark">
                                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Collapsed</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="imgCheckboxCheckmarkDisabled">
                                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Collapsed</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Indeterminate"/>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Grid x:Name="controlBackground" Margin="{StaticResource PhoneTouchTargetOverhang}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="32"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Border x:Name="rectBackground" BorderThickness="{TemplateBinding BorderThickness}" HorizontalAlignment="Left" Height="32" VerticalAlignment="Center" Width="32"/>
                                <Path x:Name="imgCheckboxCheckmarkDisabled" Data="F1 M 54.6819,26.2721L 57.2157,25.071L 60.1569,28.625C 60.6062,28.7067 61.0556,28.7884 61.8726,27.8693C 62.6895,26.9501 63.8742,25.0302 65.2631,23.2328C 66.652,21.4354 68.2451,19.7606 70.0016,18.1674C 71.7582,16.5743 73.6781,15.0629 75.598,13.5514L 76.9461,14.2867C 74.6993,16.3292 72.4526,18.3717 70.6489,20.3502C 68.8451,22.3287 67.4844,24.2432 66.0138,26.4491C 64.5432,28.655 62.9628,31.1522 61.3824,33.6495C 60.6879,33.772 59.9935,33.8946 59.3807,33.3227C 58.768,32.7508 58.2369,31.4844 57.4674,30.1936C 56.6979,28.9028 55.6899,27.5874 54.6819,26.2721 Z " Fill="{StaticResource PhoneInactiveBrush}" HorizontalAlignment="Left" Height="21" Margin="5,0,0,0" Stretch="Fill" Stroke="{StaticResource PhoneInactiveBrush}" StrokeLineJoin="Round" VerticalAlignment="Center" Width="23" Visibility="Collapsed"/>
                                <Path x:Name="imgCheckboxCheckmark" Data="F1 M 54.6819,26.2721L 57.2157,25.071L 60.1569,28.625C 60.6062,28.7067 61.0556,28.7884 61.8726,27.8693C 62.6895,26.9501 63.8742,25.0302 65.2631,23.2328C 66.652,21.4354 68.2451,19.7606 70.0016,18.1674C 71.7582,16.5743 73.6781,15.0629 75.598,13.5514L 76.9461,14.2867C 74.6993,16.3292 72.4526,18.3717 70.6489,20.3502C 68.8451,22.3287 67.4844,24.2432 66.0138,26.4491C 64.5432,28.655 62.9628,31.1522 61.3824,33.6495C 60.6879,33.772 59.9935,33.8946 59.3807,33.3227C 58.768,32.7508 58.2369,31.4844 57.4674,30.1936C 56.6979,28.9028 55.6899,27.5874 54.6819,26.2721 Z " Fill="{StaticResource PhoneContrastBackgroundBrush}" HorizontalAlignment="Left" Height="21" Margin="5,0,0,0" Stretch="Fill" Stroke="{StaticResource PhoneContrastBackgroundBrush}" StrokeLineJoin="Round" VerticalAlignment="Center" Width="23" Visibility="Collapsed"/>
                                <ContentControl x:Name="foregroundContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="1" Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="12,0,0,0" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            </Grid>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="ListBoxItemStyle1" TargetType="ListBoxItem">
            <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="HorizontalAlignment" Value="Stretch"/>
            <Setter Property="VerticalAlignment" Value="Stretch"/>
            <Setter Property="Background" Value="{StaticResource PhoneBackgroundBrush}"/>
            <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
            <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/>
            <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}"/>
            <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyNormal}"/>
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="Padding" Value="0"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListBoxItem">
                        <Grid x:Name="LayoutRoot" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}" Width="458" >
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="MouseOver"/>
                                    <VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" To=".55" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="contentPresenter"/>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="SelectionStates">
                                    <VisualState x:Name="Unselected"/>
                                    <VisualState x:Name="Selected">
                                        <Storyboard>
                                            <ColorAnimation Duration="0" To="{StaticResource PhoneAccentColor}" Storyboard.TargetProperty="(Control.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="contentPresenter" d:IsOptimized="True"/>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Rectangle x:Name="Highlight" Fill="{StaticResource PhoneAccentBrush}" IsHitTestVisible="False" Visibility="Collapsed" Margin="0,0,-13,0"/>
                            <CheckBox Content="" IsChecked="{Binding IsSelected, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="0,0,-13,0" Style="{StaticResource CheckBoxStyle1}"/>
                            <Grid Margin="12,12,-1,12">
                                <ContentControl x:Name="contentPresenter" rbc:TiltEffect.IsTiltEnabled="true" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            </Grid>

                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="ListBoxItemStyle2" TargetType="ListBoxItem">
            <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="HorizontalAlignment" Value="Stretch"/>
            <Setter Property="VerticalAlignment" Value="Stretch"/>
            <Setter Property="Background" Value="{StaticResource PhoneBackgroundBrush}"/>
            <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
            <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/>
            <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}"/>
            <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyNormal}"/>
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="Padding" Value="0"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListBoxItem">
                        <Grid x:Name="LayoutRoot" Background="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}" Width="458" >
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="MouseOver"/>
                                    <VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Background" Storyboard.TargetName="LayoutRoot">
                                                <DiscreteObjectKeyFrame KeyTime="0">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <SolidColorBrush Color="Transparent"/>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                            <DoubleAnimation Duration="0" To=".55" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="contentPresenter"/>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="SelectionStates">
                                    <VisualState x:Name="Unselected"/>
                                    <VisualState x:Name="Selected">
                                        <Storyboard>
                                            <ColorAnimation Duration="0" To="{StaticResource PhoneAccentColor}" Storyboard.TargetProperty="(Control.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="contentPresenter" d:IsOptimized="True"/>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Rectangle x:Name="Highlight" Fill="{StaticResource PhoneAccentBrush}" IsHitTestVisible="False" Visibility="Collapsed" Margin="0,0,-13,0"/>
                            <CheckBox Content="" IsChecked="{Binding IsSelected, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource CheckBoxStyle1}"/>
                            <Grid Margin="49,12,-1,12">
                                <ContentControl x:Name="contentPresenter" rbc:TiltEffect.IsTiltEnabled="true" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="0,0,-37,0"/>
                            </Grid>

                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </phoneNavigation:PhoneApplicationPage.Resources>

    <phoneNavigation:PhoneApplicationPage.FontFamily>
        <StaticResource ResourceKey="PhoneFontFamilyNormal"/>
    </phoneNavigation:PhoneApplicationPage.FontFamily>
    <phoneNavigation:PhoneApplicationPage.FontSize>
        <StaticResource ResourceKey="PhoneFontSizeNormal"/>
    </phoneNavigation:PhoneApplicationPage.FontSize>
    <phoneNavigation:PhoneApplicationPage.Foreground>
        <StaticResource ResourceKey="PhoneForegroundBrush"/>
    </phoneNavigation:PhoneApplicationPage.Foreground>

    <Grid x:Name="LayoutRoot">
    	<Grid.Background>
    		<SolidColorBrush Color="{StaticResource PhoneBackgroundColor}"/>
    	</Grid.Background>
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="MapStyleStateGroup">
                <VisualStateGroup.Transitions>
                    <VisualTransition GeneratedDuration="0:0:0.4">
                        <VisualTransition.GeneratedEasingFunction>
                            <CubicEase EasingMode="EaseIn"/>
                        </VisualTransition.GeneratedEasingFunction>
                    </VisualTransition>
                </VisualStateGroup.Transitions>
                <VisualState x:Name="Default">
                    <Storyboard>
                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="textBlock" d:IsOptimized="True"/>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="ListBoxExpanded">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="rectangle">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Collapsed</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="textBlock">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Collapsed</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="lbMapStyle">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Visible</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <DoubleAnimation Duration="0" To="239" Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="lbMapStyle" d:IsOptimized="True"/>
                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="lbMapStyle" d:IsOptimized="True"/>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <!--TitleGrid is the name of the application and page title-->
        <!--This is the name of the application and page title-->
        <Grid Grid.Row="0" x:Name="TitleGrid">
            <Grid.Projection>
                <PlaneProjection/>
            </Grid.Projection>
        </Grid>

        <!--ContentGrid is empty. Place new content here-->
        <!--This section is empty. Place new content here Grid.Row="1"-->
        <Grid Grid.Row="1" x:Name="ContentGrid" >
            <Grid.Projection>
                <PlaneProjection/>
            </Grid.Projection>
            <controls:Pivot  x:Name="pivot1" d:LayoutOverrides="GridBox" Title="{Binding Title}">
			<controls:Pivot.Background>
        		<ImageBrush Stretch="Fill" ImageSource="/VanGuideWP7;component/Images/pivotBackground.png" Opacity="0.145"/>
        	</controls:Pivot.Background>
                <controls:PivotItem x:Name="filtersPivotItem" Header="landmarks">
                    <ListBox x:Name="listBox1" ItemsSource="{Binding Landmarks}" DataContext="{Binding}" d:LayoutOverrides="Width, Height" 
            			SelectionMode="Multiple" ItemContainerStyle="{StaticResource ListBoxItemStyle1}" 
            			rbc:TiltEffect.IsTiltEnabled="true" >
                        <ListBox.ItemTemplate>
                            <DataTemplate>

                                <Grid Width="447" >
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="35"/>
                                        <ColumnDefinition Width="0.107*"/>
                                        <ColumnDefinition Width="0.893*"/>
                                    </Grid.ColumnDefinitions>
                                    <Image Grid.Column="1" Source="{Binding IconUri}" Stretch="None" Height="43" VerticalAlignment="Center" HorizontalAlignment="Center"  />
                                    <TextBlock Grid.Column="2" Text="{Binding Title}" FontFamily="{StaticResource PhoneFontFamilySemiBold}" FontSize="{StaticResource PhoneFontSizeLarge}" TextWrapping="Wrap"  VerticalAlignment="Top" Grid.ColumnSpan="2" d:LayoutOverrides="VerticalAlignment" />
                                </Grid>

                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </controls:PivotItem>
                <controls:PivotItem x:Name="socialPivotItem" Header="social landmarks">
                    <ListBox x:Name="lbSocialLandMarks" ItemsSource="{Binding Social}" DataContext="{Binding}" d:LayoutOverrides="Width, Height" 
            			SelectionMode="Multiple" ItemContainerStyle="{StaticResource ListBoxItemStyle1}" 
            			rbc:TiltEffect.IsTiltEnabled="true" >
                        <ListBox.ItemTemplate>
                            <DataTemplate>

                                <Grid Width="447" >
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="35"/>
                                        <ColumnDefinition Width="0.107*"/>
                                        <ColumnDefinition Width="0.893*"/>
                                    </Grid.ColumnDefinitions>
                                    <Image Grid.Column="1" Source="{Binding IconUri}" Stretch="None" Height="43" VerticalAlignment="Center" HorizontalAlignment="Center"  />
                                    <TextBlock Grid.Column="2" Text="{Binding Title}" FontFamily="{StaticResource PhoneFontFamilySemiBold}" FontSize="{StaticResource PhoneFontSizeLarge}" TextWrapping="Wrap"  VerticalAlignment="Top" Grid.ColumnSpan="2" d:LayoutOverrides="VerticalAlignment" />
                                </Grid>

                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </controls:PivotItem>
                <controls:PivotItem x:Name="settingsPivotItem" Header="map settings">

                    <StackPanel>
                        <Grid>
                        <TextBlock Text="Map Style" Height="37" VerticalAlignment="Top" Margin="12,10,216,0" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeSmall}" />
                        <Rectangle x:Name="rectangle" Fill="#FFF4F4F5" Height="37" Margin="12,38,26,0" Stroke="Black" VerticalAlignment="Top"/>
                        <TextBlock x:Name="textBlock" rbc:TiltEffect.IsTiltEnabled="true" Text="{Binding MapStyleString}" Height="37" VerticalAlignment="Top" Margin="23,38,41,0" FontFamily="{StaticResource PhoneFontFamilySemiBold}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneAccentBrush}" RenderTransformOrigin="0.5,0.5" >
            				<TextBlock.RenderTransform>
            					<CompositeTransform/>
            				</TextBlock.RenderTransform>
            				<i:Interaction.Triggers>
            					<i:EventTrigger EventName="MouseLeftButtonDown">
            						<ic:GoToStateAction StateName="ListBoxExpanded"/> 
            					</i:EventTrigger>
            				</i:Interaction.Triggers>
                        </TextBlock>
                        <ListBox x:Name="lbMapStyle" Height="0" Margin="0,37,0,0" VerticalAlignment="Top" ItemContainerStyle="{StaticResource ListBoxItemStyle2}" 
                                 Opacity="0" SelectionChanged="lbMapStyle_SelectionChanged">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="SelectionChanged">
                                    <ic:GoToStateAction StateName="Default"/>
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                            <TextBlock Text="Road" />
                            <TextBlock Text="Satellite" />
                            <TextBlock Text="Hybrid" />
                        </ListBox>
                        
                    </Grid>
                    </StackPanel>
                </controls:PivotItem>
            </controls:Pivot>
            <VanGuideWP7:LoadingBar
                Visibility="{Binding LoadingVisibility}"
                LoadingText="{Binding LoadingText}" 
                EnableAnimation="{Binding Loading}"
                HorizontalAlignment="Left" Height="Auto" VerticalAlignment="Top" />
        </Grid>
    </Grid>
</phoneNavigation:PhoneApplicationPage>
